<!DOCTYPE html>
<html>

<head>
    <title>{$Think.config.app_name}</title>
    {include file="public/head_frame"/}
</head>

<body class="layui-layout-body">
    <div id="LAY_app" class="layadmin-tabspage-none">
        <div class="root_box" id="LAY_app_body" v-cloak>
            <form class="layui-form" action="" lay-filter="example">
                <div class="layui-form-item">
                    <label class="layui-form-label">原密码</label>
                    <div class="layui-input-block">
                        <input type="password" placeholder="请输入你的原密码" class="layui-input" v-model="item.user_password">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input type="password" placeholder="请输入一个新密码" class="layui-input"
                            v-model="item.user_newpassword">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认下</label>
                    <div class="layui-input-block">
                        <input type="password" placeholder="请再次输入确认牢记" class="layui-input"
                            v-model="item.user_confirmpassword">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn" @click="submit">修改密码</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
{include file="public/foot_frame"/}
<script>
    var app = new Vue({
        el: ".root_box",
        data: {
            item: {
                user_confirmpassword: "",
                user_newpassword: "",
                user_password: ""
            },
        },
        created: function () { },
        methods: {
            submit: function () {
                _loading();
                $.post("/api/user/motifyPassword", Object.assign(this.item, PostCommon), function (data, status) {
                    _hideLoading();
                    console.log(data);
                    if (data.code != 200) {
                        if (data.url) {
                            location.replace(data.url);
                        }
                        _alert(data.msg);
                    } else {
                        _alert("你的密码已经修改成功，请重新登录", '重新登录', function () {
                            parent.location.href = "/admin/login";
                        });
                    }
                });
            },
        }
    });
</script>

</html>